<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateFlowScheme extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('flow_scheme', array('engine' => 'MyISAM', 'comment' => '分组管理'));
        $table
            ->addColumn('flowcode', 'string', array('limit' => 120, 'null' => true, 'comment' => '流程代码'))
            ->addColumn('flowname', 'string', array('limit' => 120,'null' => true, 'comment' => '流程名称'))
            ->addColumn('flowtype', 'string', array('limit' => 120,'null' => true, 'comment' => '流程类型'))
            ->addColumn('flowcanuser', 'string', array('limit' => 120, 'null' => true, 'comment' => ''))
            ->addColumn('flowcontent', 'text', array('null' => true, 'comment' => '流程json'))
            ->addColumn('frmcode', 'string', array('limit' => 120,'null' => true, 'comment' => ''))
            ->addColumn('frmtype', 'string', array('limit' => 120,'null' => true, 'comment' => ''))
            ->addColumn('description', 'string', array('limit' => 200,'null' => true, 'comment' => ''))
            ->addColumn('createuser', 'string', array('limit' => 120,'null' => true, 'comment' => '创建人'))
            ->addColumn('updateuser', 'string', array('limit' => 120,'null' => true, 'comment' => '更新人'))
            ->addColumn('url', 'string', array('limit' => 120,'null' => true, 'comment' => ''))
            ->addColumn('bizscheme', 'string', array('limit' => 120,'null' => true, 'comment' => ''))
            ->addColumn('isenable', 'boolean', array('limit' => 1, 'default' => 0, 'comment' => ''))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1正常)'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
